Skip to content

Fix parser joining ordinary Fortran continuation lines (issue #537)#538

Merged
mathomp4 merged 2 commits intomainfrom
hotfix/537-fortran-continuation-passthrough
Apr 9, 2026
Merged

Fix parser joining ordinary Fortran continuation lines (issue #537)#538
mathomp4 merged 2 commits intomainfrom
hotfix/537-fortran-continuation-passthrough

Conversation

@tclune
Copy link
Copy Markdown
Member

@tclune tclune commented Apr 9, 2026

Summary

Fixes #537. PR #533 introduced a regression where Parser.nextLine() joined all Fortran & continuation lines, not just those belonging to @-directive lines. This caused two failures in ordinary Fortran code:

  1. Multi-line constructs (e.g. array constructors) were collapsed into a single line, violating the 132-character limit.
  2. Commented-out continuation lines (! ScenarioDescription(...), &) became embedded mid-statement, producing invalid Fortran.

Changes

  • pFUnitParser.py: nextLine() reverted to simple one-physical-line-at-a-time behaviour
  • New isDirectiveLine(line) — detects lines beginning with @
  • New joinContinuationLines(line) — joins & continuations, called only for @-directive lines in run()
  • Parser.__init__: initialize looking_for_test_name and current_method (latent missing init)
  • testParser.py: add TestFortranContinuationPassthrough with three regression tests

@tclune tclune changed the base branch from develop to main April 9, 2026 19:29
…ssue #537)

Only join & continuation lines for pFUnit @-directive lines; pass ordinary
Fortran continuation lines through unchanged. This prevents multi-line array
constructors from being collapsed into a single line and avoids embedded
Fortran comments breaking generated code.

- Restore nextLine() to return one physical line at a time
- Add isDirectiveLine() helper method
- Add joinContinuationLines() called only for @-directive lines in run()
- Initialize looking_for_test_name and current_method in Parser.__init__
- Rewrite test_parser_continuation.py to test correct behaviour
- Update ChangeLog
@tclune tclune force-pushed the hotfix/537-fortran-continuation-passthrough branch from 213e5b0 to 840650e Compare April 9, 2026 19:36
@mathomp4 mathomp4 merged commit bb987e7 into main Apr 9, 2026
16 checks passed
@mathomp4 mathomp4 deleted the hotfix/537-fortran-continuation-passthrough branch April 9, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parser incorrectly joins Fortran continuation lines in ordinary code

2 participants